import Request from'../utils/request.js'

// 注册
export const registerUser = (data)=>{
    return Request.post('/system/users/register',data)
}
// 登录
export const loginUser = (data)=>{
    return Request.post('/system/users/login',data)
}

// 获取验证码
export const getVerifyCode = (data)=>{
    return Request.get('/system/users/getCode/' + data)
}

// 获取用户信息
export const getUserInfo = (data)=>{
    return Request.get('/system/users/getUserInfo/' + data)
}

// 修改用户信息
export const updateUserInfo = (data)=>{
    return Request.post('/system/users/updateUser',data)
}


//展示所有公告
export const findAllNotice = ()=>{
    return Request.get('/system/admins/allMessages')
}
//搜索公告
export const findNotice = (data)=>{
    return Request.post(`/system/bells/find?name=${data}`)
}
//所有留言板
export const findAllMessage = ()=>{
    return Request.get('/system/messages/all')
}
//添加留言
export const addMessage = (data)=>{
    return Request.post('/system/messages/add',data)
}

//查询所有待领取宠物
export const findAllReceive = ()=>{
    return Request.get('/system/pets/all')
}
//模糊查询所有宠物
export const findAllPet = (data)=>{
    return Request.post(`/system/adminsPet/search?petname=${data}`)
}

//添加待领取的宠物
export const addPet = (data)=>{
    return Request.post('/system/pets/add',data)
}
//获取所有贴子
export const findAllActivity = ()=>{
    return Request.get('/system/community/all')
}
//点赞
export const updateStatus = (data)=>{
    console.log(data)
    return Request.get(`/system/like/likes?id=${data.id}&likeid=${data.likeid}`)
}
//判断是否点赞
export const findStatus = (data)=>{
    return Request.post(`/system/community/like?id=${data}`)
}

//查询所有的活动
export const findAllActivitys = (searchName,searchType,searchCity)=>{
    return Request.get('/system/activity/search?name='+searchName +'&type=' + searchType + '&city=' + searchCity)
}



//查询所有丢失宠物
export const losspets = (searchQuery,selectedType,selectedLocation)=>{
    return Request.get('/system/losspets/lost?name='+searchQuery+'&type='+selectedType+'&city='+selectedLocation)
}

//添加丢失信息
export const addLoss = (data)=>{
    return Request.post('/system/losspets/addLostPet',data)
}

//申请领养
export const adopt = (data)=>{
    console.log(data)
    return Request.put(`/system/pets/updateApply?id=${data.id}&username=${data.username}`)
}
//查询自己申请的领养
export const findAdopt = (data)=>{
    return Request.post(`/system/pets/getPets?username=${data}`)
}
//取消申请
export const cancelAdopt = (data)=>{
    return Request.put(`/system/pets/cancelApply?id=${data.id}&username=${data.username}`)
}
//收藏
export const collect = (data)=>{
    return Request.post(`/system/shouchang/add?user_id=${data.user_id}&c_id=${data.c_id}`)
}

//查询所有点赞
export const findAllLike = (id)=>{
    console.log(id)
    return Request.get(`/system/like/find?userid=${id}`)
}
//查询所有收藏
export const findAllCollect = (id)=>{
    console.log(id)
    return Request.get(`/system/shouchang/find?userid=${id}`)
}
//转发
export const forward = (data)=>{
    console.log(data)
    return Request.get(`/system/like/zhuanfa?cid=${data.id}`)
}
